<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>体检预约</title>
<%@ include file="/common/meta.jsp" %>
<link href="${ctx}/css/table.css" type="text/css" rel="stylesheet"/>
<script src="${ctx}/js/table.js" type="text/javascript"></script>
<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
<script src="${ctx}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function() {
	
	var type = ${session.current_person.type};
	if(type == 0 || type == 3){
		$("#personId").attr("disabled",true);//attr("readonly","readonly");
		$("#name").attr("disabled",true);
		$("#gender").attr("disabled",true);
		$("#grade").attr("disabled",true);
		$("#clazz").attr("disabled",true);
		$("#charge").attr("disabled",true);
	}
	if(type == 1){
		$("#charge").attr("disabled",true);
	}
});
function goSave(){
	
	  var flag = false;
	  var el = document.getElementsByTagName('input');    
	  for(var i=0; i<el.length; i++){   
		  if((el[i].type=="checkbox") && (el[i].checked== true)) {
			  flag = true;
			  break;
		  }   
	  }   
	if(!flag){
		alert("请选择要预约的人");
		return ;
	}
	var appt = $("#examsetId").val();
	var apptdate = $("#peDate").val();
	if(appt == "" && apptdate ==""){
		alert("请选择体检套餐 和体检时间");
		return ;
	} else if(appt == ""){
		alert("请选择体检套餐");
		return ;
	}else if(apptdate == ""){
		alert("请选择体检时间");
		return ;
	}
	var form = document.getElementById("mainForm");
	form.action = "pe-appt!save.action";
	$("#mainForm").submit();
}
function resetInput(){
	var type = ${session.current_person.type};
	$("#startDate").val("");
	$("#endDate").val("");
	if(type == 1){
		$("#personId").val("");
		$("#name").val("");
		$("#gender").val("-1");
		$("#grade").val("");
		$("#clazz").val("");
	}
}

</script>
</head>
<body>
<div style="font-family:Arial;font-size:15px;font-weight:bold;font-style:normal;align:left">当前位置：校园体检--体检预约</div>
<form id="mainForm" action="pe-appt.action" method="post">
<input type="hidden" id="appointOrder" name="appointOrder"/>
<div id="message"><s:actionmessage theme="mytheme" cssClass="success"/></div>
    <table width="100%" class="noborder">
	    <tr>
		     <td>职工号/学号： </td><td><input type="text" name="personId" size="15" id="personId" value="${personId}"/></td>
	    	 <td>姓名： </td><td><input type="text" size="15" name="personName" id="name" value="${personName}"/></td>
	    	 <td>性别： </td><td><s:select name="personGender" id="gender" style="width:125px" theme="simple"
								   list="#{-1:'全部',0:'男',1:'女'}" listKey="key" listValue="value" value="%{personGender}"/></td>
	   </tr>
	   <tr>
	    	 <td>年级： </td><td><input type="text" name="personGrade" size="15" id="grade" value="${personGrade}"/></td>
	    	 <td>班级： </td><td><input type="text" name="personClazz" size="15" id="clazz" value="${personClazz}"/></td>
	   		 <td>班主任：  </td><td><input type="text" name="charge" size="15" id="charge" value="${charge}"/></td>
	   </tr>
	   <tr>
	    	 <td>起始时间： </td><td><input type="text" id="startDate" name="startDate" size="15" readonly="readonly" value="<s:date name='startDate' format='yyyy-MM-dd'/>" 
			   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})"/></td>
			 <td>结束时间： </td><td><input type="text" id="endDate" name="endDate" size="15" readonly="readonly" value="<s:date name='endDate' format='yyyy-MM-dd'/>" 
			   onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>
	    	 <td colspan="2" align="center">
	    	 		<input type="submit" value="查询"></input>&nbsp;&nbsp;
	    	 		<input type="button" onclick="resetInput();" value="重置"></input>
	    	 </td>
	   </tr>	    
    </table>
	<div id="dataJson" style="OVERFLOW: auto; WIDTH: 99%; HEIGHT: 250px">
    <!-- <div id="content">  -->
		<table width="95%" border="1" id="customers">
			<tr>
				<th>操作</th>
				<th>职工号/学号</th>
				<th>预约时间</th>
				<th>套餐名称</th>
				<th>年级</th>
				<th>班级</th>
				<th>班主任</th>
			</tr>
			<s:iterator value="apptList">
			<tr>
				<td> <input type="checkbox" id="checkedpersonId" name="checkedpersonIds" value="${subscriber.id}" />&nbsp;</td>
				<td>${subscriber.idNumber}&nbsp;</td>
				<td>${scheduledDate}&nbsp;</td>
				<td>${peSet.name}&nbsp;</td>
				<td>${subscriber.clazz.gradeName}&nbsp;</td>
				<td>${subscriber.clazz.className}&nbsp;</td>
				<td>${subscriber.type == 0 ? charge : ''}&nbsp;</td>
			</tr>
			</s:iterator>
		</table>
	</div>
	<table width="95%" class="noborder">
	  <tr>
			<td>套餐名称：<s:select cssStyle="width:100px" theme="simple" id="examsetId" name="examsetId" list="examsetList" listKey="id" listValue="name" emptyOption="true"/></td>
			<td>体检时间：<input type="text" id="peDate" name="peDate" size="15" readonly="readonly" value="<s:date name='peDate' format='yyyy-MM-dd'/>" 
			   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})"/></td>
			<td><input type="button" onclick="goSave();" value="保存"></td>
			</tr>
	</table> 
	
</form>
</body>
</html>